package demo1107.demo01;

import java.time.*;

/**
 * @author JYH
 * @version 1.0
 * @date 2022/11/7 15:46
 */
public class Test03 {
    public static void main(String[] args) {
        LocalDate date = LocalDate.of(2021, 10, 10);
        LocalDate now = LocalDate.now();

        Period between = Period.between(date, now);
        System.out.println(between.getYears());
        System.out.println(between.getMonths());
        System.out.println(between.getDays());


        LocalTime time = LocalTime.of(11, 11, 11);
        LocalTime now1 = LocalTime.now();

        Duration between1 = Duration.between(time, now1);
        System.out.println(between1.toHours());
        System.out.println(between1.toMinutes());
        System.out.println(between1.getSeconds());
    }
}
